from django.contrib import admin
from .models import Course, CourseReminder, Semester


@admin.register(Course)
class CourseAdmin(admin.ModelAdmin):
    list_display = ['course_name', 'user', 'teacher', 'weekday', 'start_time', 'end_time', 'location']
    list_filter = ['weekday', 'user']
    search_fields = ['course_name', 'teacher', 'location']
    date_hierarchy = 'created_at'


@admin.register(CourseReminder)
class CourseReminderAdmin(admin.ModelAdmin):
    list_display = ['course', 'user', 'reminder_time', 'status', 'sent_at']
    list_filter = ['status', 'reminder_time']
    search_fields = ['course__course_name', 'user__username']


@admin.register(Semester)
class SemesterAdmin(admin.ModelAdmin):
    list_display = ['name', 'user', 'start_date', 'end_date', 'is_current']
    list_filter = ['is_current', 'user']
    search_fields = ['name', 'user__username']
